<template>
  <div class="recitem">
    <div class="image">
      <img :src="image" alt />
    </div>
    <div class="title">{{title}}</div>
    <div class="price">
      ￥
      <strong>{{price}}</strong>
    </div>
    <!-- 右上角 x -->
    <div class="recitem-x"></div>
    <div class="recitem-alike">
      <span>找相似</span>
    </div>
    <!-- 渐变透明层 -->
    <div class="recitem-mask"></div>
  </div>
</template>

<script>
export default {
  props: {
    image: {
      type: String,
      required: true
    },
    title: {
      type: String,
      required: true
    },
    price: {
      type: Number,
      required: true
    }
  }
};
</script>

<style lang="scss">
.recitem {
  position: relative;
  padding: 30px 20px;
  background-color: #fff;
  cursor: pointer;
  .image {
    text-align: center;
    img {
      width: 80%;
    }
  }
  .title {
    height: 3em;
    font-size: 14px;
    overflow: hidden;
  }
  .price {
    padding-top: 5px;
    color: #e1251b;
    strong {
      font-size: 18px;
    }
  }
  &:hover {
    .recitem-x,
    .recitem-mask,
    .recitem-alike {
      visibility: visible;
    }
  }
  &-x {
    position: absolute;
    right: 15px;
    top: 10px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    visibility: hidden;
    background-repeat: no-repeat;
    background-image: url("");
    &:hover {
      color: #fff;
      background-color: #e1251b;
    }
  }
  &-mask {
    position: absolute;
    left: 0;
    bottom: 65px;
    height: 20px;
    width: 100%;
    background-image: linear-gradient(
      rgba(255, 255, 255, 0.7),
      rgba(255, 255, 255, 1)
    );
    visibility: hidden;
  }
  &-alike {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55px;
    background: #fff;
    text-align: center;
    visibility: hidden;
    span {
      padding: 10px 50px;
      color: #fff;
      background-color: #333;
      border-radius: 15px;
      background-size: 16px 16px;
      background-repeat: no-repeat;
      background-position: 30px 50%;
      background-image: url("");
      &:hover {
        background: #c81623;
      }
    }
  }
}
</style>